import request from "@/utils/request";

const path = '/learning'

export const pageLearning = (params) => {
  return request({
    url: path + `/${params.page}/${params.limit}`,
    params: {
      name: params.name
    }
  })
}

export const saveLearning = (data) => {
  return request({
    url: path + '/save',
    method: 'post',
    data
  })
}

export const delLearning = (id) => {
  return request({
    url: path + `/del/${id}`,
    method: 'delete'
  })
}

export const updateLearning = (data) => {
  return request({
    url: path + `/update`,
    method: 'put',
    data
  })
}

// 导出excel
export const exportExcel = () => {
  return request({
    url: path + '/export',
    // 要改成Blob格式
    responseType: 'blob'
  })
}

// 下载导入模板
export function getExportTemplate() {
  return request({
    url: path + '/template',
    responseType: 'blob' // 二进制文件流
  })
}